package com.jivesoftware.forum.model;


public class QueryBean
{

	private String queryString;
	private String filteredUser;
	private long beforeDate;
	private long afterDate;
	private long filteredThread;

	/**
	 * Returns the query string for the Query object. If the query string has
	 * not been set, this method will return null.
	 * 
	 * @return the Query query string.
	 */
	public String getQueryString()
	{
		return queryString;
	}

	/**
	 * Sets the query string for the Query object.
	 * 
	 * @param queryString
	 *            a new query string.
	 */
	public void setQueryString(String queryString)
	{
		this.queryString = queryString;
	}

	/**
	 * Returns the latest date for search results. For example, the "before
	 * date" can be used to search for messages modified more than 1 month ago.
	 * <p>
	 * If the "before date" has not been set, this method will return null.
	 * 
	 * @return the upder date boundary for search results.
	 */
	public long getBeforeDate()
	{
		return beforeDate;
	}

	/**
	 * Sets the latest date for search results. For example, the "before date"
	 * can be used to search for messages modified more than 1 month ago.
	 * 
	 * @param beforeDate
	 *            an upper date boundary for search results.
	 */
	public void setBeforeDate(long beforeDate)
	{
		this.beforeDate = beforeDate;
	}

	/**
	 * Returns the earliest date for search results. For example, the "after
	 * date" can be used to search for messages modified within the last week.
	 * <p>
	 * 
	 * If the "after date" has not been set, this method will return null.
	 * 
	 * @return the lower date boundary for search results.
	 */
	public long getAfterDate()
	{
		return afterDate;
	}

	/**
	 * Sets the earliest date for search results. For example, the "after date"
	 * can be used to search for messages modified within the last week.
	 * 
	 * @param afterDate
	 *            a lower date boundary for search results.
	 */
	public void setAfterDate(long afterDate)
	{
		this.afterDate = afterDate;
	}

	/**
	 * Returns the user that query results are restricted to. If the query is
	 * not restricted to messages posted by a certain user, this method will
	 * return null.
	 * 
	 * @return the message that results are restricted to.
	 */
	public String getFilteredUser()
	{
		return filteredUser;
	}

	/**
	 * Restricts the query results to messages posted by a specified user. Note:
	 * this method is not intended to show all messages posted by a user.
	 * Rather, it lets you filter out search results; for example, all messages
	 * matching the query "Jive rocks", but filtering out all results that
	 * aren't posted by some particular user. If you just want to see all
	 * messages posted by a user regardless of their actual content, use the
	 * ResultFilter class for a particular forum, or
	 * UserManager.userMessages(User) for a user's messages among all forums.
	 * 
	 * @param user
	 *            a User to restrict query results to.
	 * @see ResultFilter
	 */
	public void setFiltedUser(String user)
	{
		filteredUser = user;
	}

	/**
	 * Returns the thread that query results are restricted to. If the query is
	 * not restricted to messages in a certain thread, this method will return
	 * null.
	 * 
	 * @return the thread that results are restricted to.
	 */
	public long getFilteredThread()
	{
		return filteredThread;
	}

	/**
	 * Restricts the querty results to messages posted in a specified thread.
	 * 
	 * @param thread
	 *            the ForumThread to restrict query results to.
	 */
	public void setFiltedThread(long thread)
	{
		filteredThread = thread;
	}
}
